var Socket = require('net').Socket;

for (var i = 0, j = 0; j < 1; j++) {
	var socket = new Socket(),
	port = 8009,
	host = '168.39.0.78';

	socket.setEncoding('binary')
	socket.setTimeout(3000)
	socket.connect(port, host, () => {
		socket.end('hello world ' + i)
		i++
	})

	socket.on('data', (data) => {
		console.log(data)
	})

	socket.on('error', function (error) {
		console.log('error:' + error)
		if (!socket.destroyed)
			socket.destroy()
	})

	socket.on('close', function () {
		console.log('Connection closed');
	})

	socket.on('timeout', function () {
		console.log('Connection timeout');
	})
}
